<?php
/**
 * 淘宝登录处理
 * @author ome
 * @access public
 * @copyright www.shopex.net.cn 2010
 *
 */
class ome_rpc_response_taobao_session extends ome_rpc_response
{
    
    /**
     * 淘宝登录状态更新
     * @param array $session_sdf 
     * @param string $node_id 节点ID
     * @return null
     */
    function status($session_sdf){
    	
//echo 'dddd';
//echo json_encode($session_sdf);
		$top_parameters = base64_decode($session_sdf['top_parameters']);
		parse_str($top_parameters,$out);
		
		$session_sdf = array_merge($session_sdf , $out);
		unset($session_sdf['top_parameters']);
        //状态，true:正常  false:失败
        $status = 'true';//$session_sdf['agreement'];
        //淘宝session
        $session = $session_sdf['top_session'];
        //昵称：淘宝帐号
        $nickname = $session_sdf['visitor_nick'];
        $node_id = base_rpc_service::$node_id;
        echo $node_id;
		kernel::log("nickname:".$nickname) ;
        if($session && $nickname == 'qinqinbaby01'){
        // 更新addon字段
        $shopObj = &app::get('ome')->model('shop');
        $addon = array('session'=>$session, 'nickname'=>'qinqinbaby01');
        $data = array('addon'=>$addon);
        $filter = array('node_id'=>$node_id);
        $shopObj->update($data, $filter);
        // 更新KVSTORE登录状态
        app::get('ome')->setConf('taobao_session_'.$node_id, $status);
    }
        kernel::log("taobao_session:".time().json_encode($session_sdf));

    }
    
}
?>